let validatePass = (rule, value, callback) => {
    if (_this.form.oldpassword !== '') {
        if (value !== _this.form.newpassword) {
            callback(new Error('两次输入密码不一致!'))
        } else {
            callback()
        }
    } else {
        callback()
    }
}
//配置代码
let _this;
export default function(data){
    _this=data;
    return {
        column: [{
            label: '个人信息',
            prop: 'info',
            option: {
                submitText: '修改',
                column: [ {
                    label: '用户名',
                    span: 12,
                    readonly: true,
                    row: true,
                    prop: 'userName'
                }, {
                    label: '手机号',
                    span: 12,
                    row: true,
                    prop: 'phone'
                }]
            }
        }, {
            label: '修改密码',
            prop: 'password',
            option: {
                submitText: '修改',
                column: [{
                    label: '原密码',
                    span: 12,
                    row: true,
                    type: 'password',
                    prop: 'oldpassword',
                    rules: [{required: true, min: 6, message: '原密码不能为空且不少于6位', trigger: 'change'}]
                }, {
                    label: '新密码',
                    span: 12,
                    row: true,
                    type: 'password',
                    prop: 'newpassword',
                    rules: [{required: true, min: 6, message: '密码不能为空且不少于6位', trigger: 'change'}]
                }, {
                    label: '确认密码',
                    span: 12,
                    row: true,
                    type: 'password',
                    prop: 'newpasswords',
                    rules: [
                        {required: true, validator: validatePass, trigger: 'blur'}
                    ]
                }]
            }
        }]
    }
}
